<?php

namespace App\Repositories;
use Doctrine\Common\Collections\Collection;
use App\Models\User;
class UserRepository
{
    /** @var User 注入的User model */
    protected $user;
    /**
    * UserRepository constructor.
    * @param User $user
    */
    public function __construct(User $user)
    {
        $this->user = $user;
    }
    /**
    * 回传大于？年纪的数据
    * @param integer $age
    * @return Collection
    */
    public function count($age)
    {
        return $this->user
            ->where('age', '>', $age)
            ->orderBy('age')
            ->get();
    }
}